//
//  HMGoodsHeaderTableViewCell.m
//  localLife
//
//  Created by Limonwei on 15/11/27.
//  Copyright © 2015年 heima. All rights reserved.
//

#import "HMGoodsHeaderTableViewCell.h"

@interface HMGoodsHeaderTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *introLabel;
@property (weak, nonatomic) IBOutlet UIView *mapView;

@property (weak, nonatomic) IBOutlet UIView *shareView;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@end

@implementation HMGoodsHeaderTableViewCell

- (void)awakeFromNib {
    
    
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
}

-(CGFloat)heightForCell{
    
    CGRect introRect = _introLabel.frame;
    
    CGRect caluateRect = [_introLabel.text boundingRectWithSize:CGSizeMake(introRect.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil];
    
    introRect.size = caluateRect.size;
    
    _introLabel.frame = introRect;
    
    CGFloat height = introRect.size.height + _mapView.frame.size.height + _shareView.frame.size.height + 5;
    
    return height;
    
}

-(void)setModel:(HMGoodsModel *)model{
    
    
    _model = model;
    
    _introLabel.text = _model.content;
    
    _nameLabel.text = _model.title;
    
    _priceLabel.text = [NSString stringWithFormat:@"人均消费 %@",_model.price];
    
    [self setNeedsLayout];
    
}

@end














